.class public Lcom/kuguo/ad/ab;
.super Ljava/lang/Object;

# interfaces
.implements Ljava/lang/Runnable;


# instance fields
.field private a:Landroid/content/Context;

.field private b:Lcom/kuguo/ad/ap;

.field private c:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x4

    iput v0, p0, Lcom/kuguo/ad/ab;->c:I

    iput-object p1, p0, Lcom/kuguo/ad/ab;->a:Landroid/content/Context;

    new-instance v0, Lcom/kuguo/ad/ap;

    invoke-direct {v0, p1}, Lcom/kuguo/ad/ap;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcom/kuguo/ad/ab;->b:Lcom/kuguo/ad/ap;

    return-void
.end method

.method private b()V
    .locals 6

    const/4 v0, 0x0

    move v1, v0

    :goto_0
    if-nez v1, :cond_1

    iget v2, p0, Lcom/kuguo/ad/ab;->c:I

    if-ge v0, v2, :cond_1

    invoke-static {}, Landroid/os/Environment;->getExternalStorageState()Ljava/lang/String;

    move-result-object v2

    const-string v3, "mounted"

    invoke-virtual {v3, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_0

    invoke-direct {p0}, Lcom/kuguo/ad/ab;->d()Z

    move-result v1

    :goto_1
    add-int/lit8 v0, v0, 0x1

    const-wide/16 v2, 0x7d0

    :try_start_0
    invoke-static {v2, v3}, Ljava/lang/Thread;->sleep(J)V
    :try_end_0
    .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception v2

    invoke-virtual {v2}, Ljava/lang/InterruptedException;->printStackTrace()V

    goto :goto_0

    :cond_0
    const-string v3, "android__log"

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "externalStorageState = "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v3, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_1

    :cond_1
    return-void
.end method

.method private c()V
    .locals 5

    iget-object v0, p0, Lcom/kuguo/ad/ab;->a:Landroid/content/Context;

    invoke-static {v0}, Lcom/kuguo/ad/a;->k(Landroid/content/Context;)Ljava/lang/String;

    move-result-object v0

    if-eqz v0, :cond_0

    iget-object v1, p0, Lcom/kuguo/ad/ab;->b:Lcom/kuguo/ad/ap;

    iput-object v0, v1, Lcom/kuguo/ad/ap;->n:Ljava/lang/String;

    :cond_0
    iget-object v0, p0, Lcom/kuguo/ad/ab;->b:Lcom/kuguo/ad/ap;

    iget-object v1, p0, Lcom/kuguo/ad/ab;->a:Landroid/content/Context;

    invoke-static {v1}, Lcom/kuguo/ad/r;->d(Landroid/content/Context;)Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Lcom/kuguo/ad/ap;->l:Ljava/lang/String;

    iget-object v0, p0, Lcom/kuguo/ad/ab;->b:Lcom/kuguo/ad/ap;

    const/16 v1, 0xb

    iput v1, v0, Lcom/kuguo/ad/ap;->m:I

    iget-object v0, p0, Lcom/kuguo/ad/ab;->b:Lcom/kuguo/ad/ap;

    iget-object v0, v0, Lcom/kuguo/ad/ap;->n:Ljava/lang/String;

    invoke-static {v0}, Lcom/kuguo/ad/a;->e(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    if-eqz v0, :cond_1

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "-13,"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget-object v2, p0, Lcom/kuguo/ad/ab;->a:Landroid/content/Context;

    invoke-static {v2}, Lcom/kuguo/ad/a;->s(Landroid/content/Context;)I

    move-result v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, ";"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    :cond_1
    const-string v1, "android__log"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "request statu is ------------ "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Lcom/kuguo/c/a;->a(Ljava/lang/String;Ljava/lang/Object;)V

    iget-object v1, p0, Lcom/kuguo/ad/ab;->b:Lcom/kuguo/ad/ap;

    iput-object v0, v1, Lcom/kuguo/ad/ap;->j:Ljava/lang/String;

    iget-object v0, p0, Lcom/kuguo/ad/ab;->a:Landroid/content/Context;

    invoke-static {v0}, Lcom/kuguo/ad/a;->q(Landroid/content/Context;)Landroid/location/Location;

    move-result-object v0

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "location : "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Lcom/kuguo/ad/a;->a(Ljava/lang/String;)V

    if-eqz v0, :cond_2

    iget-object v1, p0, Lcom/kuguo/ad/ab;->b:Lcom/kuguo/ad/ap;

    invoke-virtual {v0}, Landroid/location/Location;->getLongitude()D

    move-result-wide v2

    iput-wide v2, v1, Lcom/kuguo/ad/ap;->f:D

    iget-object v1, p0, Lcom/kuguo/ad/ab;->b:Lcom/kuguo/ad/ap;

    invoke-virtual {v0}, Landroid/location/Location;->getLatitude()D

    move-result-wide v2

    iput-wide v2, v1, Lcom/kuguo/ad/ap;->e:D

    invoke-virtual {v0}, Landroid/location/Location;->getLongitude()D

    move-result-wide v1

    invoke-virtual {v0}, Landroid/location/Location;->getLatitude()D

    move-result-wide v3

    invoke-static {v1, v2, v3, v4}, Lcom/kuguo/ad/a;->a(DD)Ljava/lang/String;

    move-result-object v0

    iget-object v1, p0, Lcom/kuguo/ad/ab;->b:Lcom/kuguo/ad/ap;

    iput-object v0, v1, Lcom/kuguo/ad/ap;->s:Ljava/lang/String;

    :cond_2
    return-void
.end method

.method private d()Z
    .locals 7

    const/4 v5, 0x0

    new-instance v0, Lorg/apache/http/client/methods/HttpPost;

    const-string v1, "http://www.cooguo.com/cooguogw/list.action"

    invoke-direct {v0, v1}, Lorg/apache/http/client/methods/HttpPost;-><init>(Ljava/lang/String;)V

    invoke-direct {p0}, Lcom/kuguo/ad/ab;->c()V

    iget-object v1, p0, Lcom/kuguo/ad/ab;->b:Lcom/kuguo/ad/ap;

    invoke-virtual {v1}, Lcom/kuguo/ad/ap;->a()V

    :try_start_0
    new-instance v1, Lorg/apache/http/entity/ByteArrayEntity;

    iget-object v2, p0, Lcom/kuguo/ad/ab;->b:Lcom/kuguo/ad/ap;

    invoke-virtual {v2}, Lcom/kuguo/ad/ap;->b()[B

    move-result-object v2

    invoke-direct {v1, v2}, Lorg/apache/http/entity/ByteArrayEntity;-><init>([B)V

    invoke-virtual {v0, v1}, Lorg/apache/http/client/methods/HttpPost;->setEntity(Lorg/apache/http/HttpEntity;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_6

    :goto_0
    :try_start_1
    iget-object v1, p0, Lcom/kuguo/ad/ab;->a:Landroid/content/Context;

    invoke-static {v1}, Lcom/kuguo/ad/r;->a(Landroid/content/Context;)Lorg/apache/http/client/HttpClient;

    move-result-object v1

    if-nez v1, :cond_0

    move v0, v5

    :goto_1
    return v0

    :cond_0
    invoke-interface {v1, v0}, Lorg/apache/http/client/HttpClient;->execute(Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/HttpResponse;

    move-result-object v1

    invoke-interface {v1}, Lorg/apache/http/HttpResponse;->getStatusLine()Lorg/apache/http/StatusLine;

    move-result-object v1

    invoke-interface {v1}, Lorg/apache/http/StatusLine;->getStatusCode()I

    move-result v1

    const-string v2, "android__log"

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "b-----------status: "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-static {v2, v3}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_1
    .catch Lorg/apache/http/client/ClientProtocolException; {:try_start_1 .. :try_end_1} :catch_5
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_2

    const/16 v2, 0xc8

    if-ne v1, v2, :cond_1

    const/4 v0, 0x1

    :try_start_2
    iget-object v1, p0, Lcom/kuguo/ad/ab;->b:Lcom/kuguo/ad/ap;

    iget-object v1, v1, Lcom/kuguo/ad/ap;->n:Ljava/lang/String;

    invoke-static {v1}, Lcom/kuguo/ad/a;->d(Ljava/lang/String;)Z

    const-string v1, "android__log"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "clear status cooId is --------- "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget-object v3, p0, Lcom/kuguo/ad/ab;->b:Lcom/kuguo/ad/ap;

    iget-object v3, v3, Lcom/kuguo/ad/ap;->n:Ljava/lang/String;

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Lcom/kuguo/c/a;->a(Ljava/lang/String;Ljava/lang/Object;)V
    :try_end_2
    .catch Lorg/apache/http/client/ClientProtocolException; {:try_start_2 .. :try_end_2} :catch_0
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_4
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_3

    goto :goto_1

    :catch_0
    move-exception v1

    move-object v6, v1

    move v1, v0

    move-object v0, v6

    :goto_2
    invoke-virtual {v0}, Lorg/apache/http/client/ClientProtocolException;->printStackTrace()V

    move v0, v1

    goto :goto_1

    :cond_1
    :try_start_3
    invoke-virtual {v0}, Lorg/apache/http/client/methods/HttpPost;->abort()V
    :try_end_3
    .catch Lorg/apache/http/client/ClientProtocolException; {:try_start_3 .. :try_end_3} :catch_5
    .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_1
    .catch Ljava/lang/Exception; {:try_start_3 .. :try_end_3} :catch_2

    move v0, v5

    goto :goto_1

    :catch_1
    move-exception v0

    move v1, v5

    :goto_3
    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V

    move v0, v1

    goto :goto_1

    :catch_2
    move-exception v0

    move v0, v5

    goto :goto_1

    :catch_3
    move-exception v1

    goto :goto_1

    :catch_4
    move-exception v1

    move-object v6, v1

    move v1, v0

    move-object v0, v6

    goto :goto_3

    :catch_5
    move-exception v0

    move v1, v5

    goto :goto_2

    :catch_6
    move-exception v1

    goto :goto_0
.end method


# virtual methods
.method public a()V
    .locals 1

    new-instance v0, Ljava/lang/Thread;

    invoke-direct {v0, p0}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;)V

    invoke-virtual {v0}, Ljava/lang/Thread;->start()V

    return-void
.end method

.method public run()V
    .locals 0

    invoke-direct {p0}, Lcom/kuguo/ad/ab;->b()V

    return-void
.end method
